package com.cat.model.common.util;

import java.io.Serializable;

import com.alonew.json.JSONException;
import com.alonew.json.JSONObject;

public class ResultJson implements Serializable {

	private static final long serialVersionUID = 5060512553098477928L;

	private int ret = 0;
	private String msg = "ok";
	private String ver = null;
	private JSONObject data = null;
	
	public ResultJson() {
		
	}
	
	public ResultJson(JSONObject data) {
		this.data = data;
	}

	public int getRet() {
		return ret;
	}

	public void setRet(int ret) {
		this.ret = ret;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public String getVer() {
		return ver;
	}

	public void setVer(String ver) {
		this.ver = ver;
	}

	public JSONObject getData() {
		return data;
	}

	public void setData(JSONObject data) {
		this.data = data;
	}

	public JSONObject toJson() {
		JSONObject json = new JSONObject();
		try {
			json.put("ret", ret);
			json.put("msg", msg);
			json.put("ver", ver);
			json.put("data", data);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return json;
	}

	@Override
	public String toString() {
		return toJson().toString();
	}
}
